package com.china.zhuoyue.ui.activity.user

import androidx.recyclerview.widget.LinearLayoutManager
import com.china.zhuoyue.databinding.ActivityMessageNoticeBinding
import com.china.zhuoyue.databinding.ItemMessageNoticeBinding
import com.china.zhuoyue.ui.base.BaseActivity
import com.china.zhuoyue.ui.base.BaseRecyclerAdapter
import com.china.zhuoyue.ui.base.BaseViewHolder

class MessageNoticeActivity : BaseActivity<ActivityMessageNoticeBinding>() {
    override fun initView() {
        loadView {
            rvNotice.adapter = MessageNoticeAdapter().apply {
                datas = MessageNoticeAdapter.NOTICE
            }
            rvNotice.layoutManager = LinearLayoutManager(mThis)
        }
    }
}

data class MessageNotice(
    val time: String,
    val title: String,
    val desc: String,
)

class MessageNoticeAdapter : BaseRecyclerAdapter<BaseViewHolder<ItemMessageNoticeBinding>, MessageNotice>() {
    companion object {
        val NOTICE = mutableListOf<MessageNotice>().apply {
            add(MessageNotice("2021-06-25 10:00", "实名认证通过", "您提交的实名认证已经通过公司认证"))
            add(MessageNotice("2021-06-23 11:00", "房屋认证通过", "您提交的房屋认证已经通过公司认证"))
        }
    }

    override fun onBindViewHolder(holder: BaseViewHolder<ItemMessageNoticeBinding>, bean: MessageNotice, position: Int) {
        holder.vb.apply {
            bean.apply {
                tvTime.text = time
                tvTitle.text = title
                tvDesc.text = desc
            }
        }
    }
}